package com.bang.sgg.springboot02mybatis.persist.model.mapper;

import com.bang.sgg.springboot02mybatis.persist.model.Robot;
import com.bang.sgg.springboot02mybatis.persist.model.User;
import org.apache.ibatis.annotations.*;

public interface RobotMapperExt extends RobotMapper {

    User getOne(Long userId);

    @Options(useGeneratedKeys =true,keyProperty = "robotId")
    @Insert("INSERT INTO `robot`( `user_id`, `robot_name`, `tel`) VALUES (#{userId},#{robotName},#{tel})")
    int insertInto(Robot robot);

    @Select("SELECT * FROM robot WHERE robot_id = #{id}")
    Robot selectOne(Long id);


    @Delete("delete from robot where robot_id=#{id}")
    int deleteOne(Long id);

//    @Update("UPDATE `robot` SET `robot_name` = #{robotName} WHERE `robot_id` = #{robotId}")
    @Update("update robot set robot_name=#{robotName} where robot_id=#{robotId}")
    int updateOne(Robot robot);


}
